#!/usr/bin/env bash
set -e
PATH=$PATH:/usr/sbin:/sbin

mkdir -p lpk;
mkdir -p out/dist;
mkdir -p backend/out;

pushd ui;
pnpm run build-only;
popd;

pushd backend;
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -trimpath -ldflags '-buildid=' -buildvcs=false -gcflags "all=-N -l" -o out/helloworld ;
popd;

rm -r out/dist;
cp -r ui/dist out/dist;
cp backend/out/helloworld out/helloworld;
